<div class="page-search-bar">
	<div class="widget-header">
		<div class="align-left">
			<%= simple_form_for(orders_path, :method => 'get') do |f| %>
			<select name="order[order_type]" class="input-xs" placeholder="订单类型">
				<option value="">订单类型</option>
				<option value="REG">正式订单</option>
				<option value="TEMP">临时订单</option>
			</select>
			<input type="text" name="order[order_code]" class="input-xs" placeholder="订单编号">
			<select name="order[customer_id]" class="input-xs" placeholder="客户">
				<option value="">客户名</option>
				<% Customer.all.each do |customer|%>
				<option value="<%= customer.id%>"><%= customer.name%></option>
				<% end %>
			</select>

			<input type="text" name="order[customer_po]" class="input-xs" placeholder="客户订单号">
			<input type="text" name="order[contract_no]" class="input-xs" placeholder="合同号">
			<input type="text" name="order[tieta_settlement_no]" class="input-xs" placeholder="铁塔财务报账号">
			<div class="widget-buttons buttons-bordered">
				<input class="btn btn-blue btn-xs" name="commit" type="submit" value="搜索">
			</div>
			<% end %>
		</div>
	</div>
</div>

<div class="row">
	<div class="col-xs-12 col-md-12">

		<div class="widget">

			<div class="widget-header bordered-bottom bordered-themeprimary">
				<i class="widget-icon fa fa-tasks themeprimary"></i>
				<span class="widget-caption themeprimary">订单列表</span>
				<div class="widget-buttons buttons-bordered">
					<%= button_to '添加订单', new_order_path, method: :get, :class => "btn btn-blue btn-xs" %>
				</div>

			</div><!--Widget Header-->
			<div class="widget-body">
				<div class="widget-main no-padding">

					<div class="flip-scroll">
						<div class="dataTables_wrapper form-inline no-footer">
							<form action="<%= new_invoice_path %>" method="get">

								<input type="submit" name="commit" value="开票" class="btn btn-blue btn-xs">

								<table class="table table-bordered table-striped table-condensed flip-content">
									<thead class="flip-content bordered-palegreen">
										<tr>
											<th></th>
											<th>日期</th>
											<th>订单编号</th>
											<th>客户</th>
											<th>客户订单号</th>
											<th>金额</th>
											<th>付款方式</th>
											<th>交期</th>
											<th>合同号</th>


											<th></th>
										</tr>
									</thead>

									<tbody>
										<% @orders.each do |order| %>
										<tr>
											<td>
											<input type=checkbox name="order_id[]" value="<%= order.id%>" class="default" >
											</td>
											<td><%= order.created_at.strftime("%Y-%m-%d") %></td>
											<td><%= order.order_code %></td>
											<td><%= order.customer.name %></td>
											<td><%= order.customer_po %></td>
											<td><%= order.amount %></td>
											<td><%= order.payment_term %></td>
											<td><%= order.due_date %></td>
											<td><%= order.contract_no %></td>
											<td><%= link_to image_tag('show.png'), order %>
											<%= link_to image_tag('edit.gif'), edit_order_path(order) %>
											<%= link_to image_tag('trash.gif'), order, method: :delete, data: { confirm: 'Are you sure?' } %></td>
										</tr>
										<% end %>
									</tbody>
								</table>
							</form>

							<div class="row DTTTFooter">

								<div class="col-xs-12 col-md-12">
									<div class="dataTables_paginate paging_bootstrap" id="simpledatatable_paginate">
										<%= paginate @orders, window: 1, outer_window: 1, remote: true %>
									</div>
								</div>
							</div>

						</div>
						
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
